<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// 
//  user_model.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-05-21.
//  Copyright 2011 lishuzu. All rights reserved.
// 


class Fan_model extends CI_Model
{
		function __construct(){
			parent::__construct();
			$this->load->model('user_model');
			$this->user = $this->session->userdata('user') ? $this->session->userdata('user') : '';
			$this->uid = $this->uri->segment(3) ? intval($this->uri->segment(3)) : $this->user['uid'];
		}
		
		function get_fans(){
			$data = array();
			//page
			$_SGLOBAL = $this->config->item('SGLOBAL');
			$_SGLOBAL['multipage_config']['base_url'] = base_url().'fan/index/'.$this->uid;
			$_SGLOBAL['multipage_config']['uri_segment'] = '4';
			// $_SGLOBAL['multipage_config']['per_page'] = '1';
			$offset = $this->uri->segment($_SGLOBAL['multipage_config']['uri_segment']);
			$data = $this->ship_model->get_fans($this->uid, $_SGLOBAL['multipage_config']['per_page'], $offset);
			if ($data) {
				//page
				$_SGLOBAL['multipage_config']['total_rows'] = $data['count'];
				$this->pagination->initialize($_SGLOBAL['multipage_config']);
				$multi = $this->pagination->create_links();
				$data['multi'] = $multi;
				return $data;
			}else{
				return false;
			}
		}
}
?>